package com.ecp.base.bean;

import com.ecp.commons.serialization.Variant;
import com.ecp.commons.serialization.GenericBean;
import com.ecp.commons.annotation.VariantType;

public class SystemArgument extends GenericBean {

	public static final int		TYPE_CHAR			= 0;
	public static final int		TYPE_FILE			= 1;
	public static final int		TYPE_PASSWORD		= 2;
	public static final int		IS_PUBLIC_TRUE		= 1;
	public static final int		IS_PUBLIC_FALSE		= 0;

	@Override
	public void defineVariantSet() {
		this.entity = "t_sys_arguments";
		map.put("id", new Variant().setType(VariantType.INTEGER).setPk(true).setNullable(false));
		map.put("argKey", new Variant().setLength(255).setNullable(false));
		map.put("argValue", new Variant().setLength(3072));
		map.put("argDesc", new Variant().setLength(1024));
		map.put("argName", new Variant().setLength(255).setNullable(false));
		map.put("argType", new Variant().setType(VariantType.INTEGER).setNullable(false));
		map.put("isPublic", new Variant().setType(VariantType.INTEGER).setNullable(false));
		map.put("m_id", new Variant().setType(VariantType.INTEGER).setNullable(false));
	}

	@Override
	public void resetValues() {
		this.set("id", "");
		this.set("argKey", "");
		this.set("argValue", "");
		this.set("argDesc", "");
		this.set("argName", "");
		this.set("argType", "");
		this.set("isPublic", "1");
		this.set("m_id", "0");
	}

	public int getId() {
		return this.getInt("id");
	}

	public String getArgKey() {
		return this.getString("argKey");
	}

	public String getArgValue() {
		return this.getString("argValue");
	}

	public String getArgDesc() {
		return this.getString("argDesc");
	}

	public String getArgName() {
		return this.getString("argName");
	}

	public int getArgType() {
		return this.getInt("argType");
	}

	public int getIsPublic() {
		return this.getInt("isPublic");
	}

	public int getM_id() {
		return this.getInt("m_id");
	}

	public void setId(int id) {
		this.set("id", id);
	}

	public void setArgKey(String argKey) {
		this.set("argKey", argKey);
	}

	public void setArgValue(String argValue) {
		this.set("argValue", argValue);
	}

	public void setArgDesc(String argDesc) {
		this.set("argDesc", argDesc);
	}

	public void setArgName(String argName) {
		this.set("argName", argName);
	}

	public void setArgType(int argType) {
		this.set("argType", argType);
	}

	public void setIsPublic(int isPublic) {
		this.set("isPublic", isPublic);
	}

	public void setM_id(int m_id) {
		this.set("m_id", m_id);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + getId();
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SystemArgument other = (SystemArgument) obj;
		if (getId() != other.getId())
			return false;
		return true;
	}
}